#include<iostream>
#include<signal.h>
#include<unistd.h>
#include<sys/types.h>
#include<sys/wait.h>

int main()
{
    signal(SIGCHLD, SIG_IGN);
    pid_t id = fork();
    if(id == 0)
    {
        //child:
        int cnt = 10;
        while(cnt--)
        {
            std::cout << "I am child, my pid is " << getpid() << std::endl;
            sleep(1);
        }
        exit(1);
    }
    //father:
    while(true)
    {
        std::cout << "father running, pid is " << getpid() << std::endl;
        sleep(1);
    }
    return 0;
}